package com.keguoyu.easymvp.ioc;

import com.keguoyu.easymvp.commons.PluginFactory;

public final class PluginManager {
  private static final InstanceManager<PluginInterface> sManager =
      new InstanceManager<>(PluginConfig.getMappingMap(), true);

  private PluginManager() {
    throw new RuntimeException("Can't create PluginManager instance");
  }

  public static <T extends PluginInterface> T get(Class<T> clss) {
    return sManager.get(clss);
  }

  public static <T extends PluginInterface> void register(Class<T> clazz, PluginFactory<T> factory) {
    sManager.register(clazz, factory);
  }

}
